package com.nexus.auth;

import com.nexus.core.auth.LoginUserType;
import com.nexus.core.enums.BaseEnum;
import com.nexus.core.exception.AuthenicException;
import com.nexus.core.exception.BaseException;
import com.nexus.core.response.ResponseMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@ComponentScan("com.nexus.*")
@RestController
@RequestMapping("auth")
public class NexusWebAuthApplication {

    @Autowired
    private TestService testService;

    @GetMapping("test1")
    public ResponseEntity<?> test() throws AuthenicException {
        return ResponseMessage.OK(testService.sayHello("test1"));
    }
//    @Bean
//    public Queue authQueue() {
//        return new Queue("auth.queues", true); // true表示持久化队列
//    }

    public static void main(String[] args) throws BaseException {

        LoginUserType byValue = BaseEnum.getByValue(LoginUserType.class, 1);
        System.out.println(byValue);
        byValue = BaseEnum.getByValue(LoginUserType.class, 2);
        System.out.println(byValue);
        SpringApplication.run(NexusWebAuthApplication.class, args);


    }


}
